{% extends "base.html" %}
{% block pagetitle %}
  Create a new poll
{% endblock %}
{% block main %}
  <script type="text/javascript" src="/javascripts/jquery.js"></script>
  <form name="create" action="/create" method="post">
    <fieldset>
      <legend>Create a new poll</legend>
      <label for="question">Question</label>
      {{ form.question.errors }}
      <input type="text" name="question" id="question" size="50"/>

      <label for="choices">Possible answers</label>
      <input type="text" id="choices" name="choices" />
      <input type="text" id="choices" name="choices" />
      <input type="text" id="choices" name="choices" />
      <input type="text" id="choices" name="choices" />
      <img class="addelement" src="/images/add.png" onclick='$("#choices").after("<input type=\"text\" id=\"choices\" name=\"choices\" />");' />
      <label for="start_date">Start date (YYYY-MM-DD)</label>
      {{ form.start_date.errors }}
      <input type="text" name="start_date" id="start_date" />

      <label for="end_date">End date (YYYY-MM-DD)</label>
      {{ form.end_date.errors }}
      <input type="text" name="end_date" id="end_date" />
    <input type="submit" value="Create poll!">
    </fieldset>
  </form>
{% endblock %}
